<template>
	<image src="/static/img/5.png"></image>
	<div class="navigation">
		<p class="navigationIn" :class="{courseStyle:overview}" @click="toOverview">课程概述</p>
		<p class="navigationIn" :class="{courseStyle:details}" @click="toDetails">课程详情</p>
		<p class="navigationIn" :class="{courseStyle:syllabus}" @click="toSyllabus">课程大纲</p>
	</div>
	<div class="courseIn" v-show="overview">
		<p class="h2">课程名字</p>
		<p class="h4">课程机构：123</p>
		<p class="h4">报名人数：1234</p>
		<p class="h2">课程简介</p>
		<p class="h4">不知道</p>
		<p class="h2">授课老师</p>
		<p class="h4">授课老师：开老师</p>
	</div>
	<div class="courseIn" v-show="details">
		<h1 style="margin-left: 20px;">课程详情</h1>
		<p style="margin-left: 20px;">课程详情课程详情课程详情课程详情课程详情课程详情课程详情课程详情课程详情课程详情课程详情课程详情</p>
	</div>
	<div class="courseIn" v-show="syllabus">
		<div style="width: 100%; height: 100%; overflow-y: auto;">
			<ul>
				<li class="syllabusLi" v-for="item in syllabuslist" :key="item.id">
					<image src="/static/logo.png"></image>
					<span class="span">{{ item.name }}</span><span class="span">{{ item.teacher }}</span><span
						class="span">{{ item.time }}</span>
					<image src="/static/icon/play.png" @click="toRegister"></image>
					<p class="p" v-if="item.member">会员</p>
				</li>
			</ul>
		</div>
	</div>
	<button class="btn" @click="register">报名学习</button>
</template>

<script setup>
	import {
		ref
	} from 'vue';
	const overview = ref(true)
	const details = ref(false)
	const syllabus = ref(false)

	function toRegister() {
		uni.redirectTo({
			url: '/pages/Course/Register'
		});
	}
	const syllabuslist = ref([{
			id: 1,
			name: '课程1',
			teacher: '开老师',
			time: '13:16',
			member: false
		},
		{
			id: 2,
			name: '课程1',
			teacher: '开老师',
			time: '13:16',
			member: false
		},
		{
			id: 3,
			name: '课程1',
			teacher: '开老师',
			time: '13:16',
			member: false
		},
		{
			id: 4,
			name: '课程1',
			teacher: '开老师',
			time: '13:16',
			member: true
		},
		{
			id: 5,
			name: '课程1',
			teacher: '开老师',
			time: '13:16',
			member: true
		},
		{
			id: 6,
			name: '课程1',
			teacher: '开老师',
			time: '13:16',
			member: true
		},
		{
			id: 7,
			name: '课程1',
			teacher: '开老师',
			time: '13:16',
			member: true
		},
		{
			id: 8,
			name: '课程1',
			teacher: '开老师',
			time: '13:16',
			member: true
		},
		{
			id: 9,
			name: '课程1',
			teacher: '开老师',
			time: '13:16',
			member: true
		},
		{
			id: 10,
			name: '课程1',
			teacher: '开老师',
			time: '13:16',
			member: true
		},
		{
			id: 11,
			name: '课程1',
			teacher: '开老师',
			time: '13:16',
			member: true
		}
	])


	function register() {

	}

	function toOverview() {
		overview.value = true
		details.value = false
		syllabus.value = false
	}

	function toDetails() {
		overview.value = false
		details.value = true
		syllabus.value = false
	}

	function toSyllabus() {
		overview.value = false
		details.value = false
		syllabus.value = true
	}
</script>

<style>
	.p {
		width: 25px;
		height: 15px;
		background-color: #ff5e8b;
		font-size: 10px;
		margin-top: 2px;
		margin-left: 5px;
		padding-left: 3px;
		padding-top: 1px;
		border-radius: 4px;
		color: white;
	}

	.syllabusLi {
		border: 2px solid #0066ff;
		border-bottom: 0px;
		width: 99%;
		height: 50px;
		text-align: left;
		display: flex;
	}

	.syllabusLi image {
		width: 50px;
		height: 50px;
	}

	.span {
		padding-left: 5px;
		padding-top: 15px;
		width: 21%;
	}

	.h4 {
		margin-top: 15px;
		margin-left: 45px;
		opacity: 0.8;
	}

	.h2 {
		font-size: 25px;
		margin-top: 35px;
		margin-left: 15px;
	}

	.navigation {
		margin-top: 10px;
		display: flex;
		width: 100vw;
		height: 50px;

	}

	.navigationIn {
		font-size: 20px;
		width: 80px;
		height: 30px;
		border-bottom: 3px solid black;
		text-align: center;
		margin-left: 11%;
	}

	image {
		width: 100vw;
	}

	.courseIn {
		height: 56vh;
	}

	button {
		width: 100%;
		background-color: orange;
		color: white;
		border: none;
		padding: 10px 20px;
		cursor: pointer;
		position: fixed;
		bottom: 0;
	}

	.courseStyle {
		color: #00b9ff;
		border-bottom: 3px solid #00b9ff;
	}
</style>